#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#define maxn 25
int n,k,m,a[maxn];

int main()
{
	while (scanf("%d %d %d", &n, &k, &m) == 3 && n)
	{
		for (int i = 1; i <= n; i++)
			a[i] = i;
		int remain = n;
		int p1 = 1;
		int p2 = n;
		while (remain)
		{
			p1 = circular(a, 1, k);
			p2 = circular(a, -1, m);

			printf("%3d", p1);
			remain--;

			if (p2 != p1)
			{
				printf("%3d", p2);
				remain--;
			}

			a[p1] = a[p2] = 0;
			if (remain)
			{
				printf(",");
			}

		}

	}
	return 0;
}